package receiver;

import static org.junit.Assert.*;

import org.junit.Test;

public class TestSelection {

	@Test
	public void testGetDebut() {
		Selection selection = new Selection();
		assertTrue(selection.getDebut() == 0);
	}

	@Test
	public void testGetFin() {
		Selection selection = new Selection();
		assertTrue(selection.getFin() == 0);
	}


	@Test
	public void testSetDebut() {
		Selection selection = new Selection();
		selection.setDebut(3);
		assertTrue(selection.getDebut() == 3);
		assertTrue(selection.getDebut() <= selection.getFin());
	}

	@Test
	public void testSetFin() {
		Selection selection = new Selection();
		selection.setFin(5);
		assertTrue(selection.getFin() == 5);
		assertTrue(selection.getDebut() <= selection.getFin());
	}
	
	@Test
	public void testClone() throws CloneNotSupportedException {
		Selection selection = new Selection();
		selection.setFin(5);
		assertTrue(selection.getFin() == 5);
		assertTrue(selection.getDebut() <= selection.getFin());
		
		Selection nouvelleSelection = (Selection) selection.clone();
		nouvelleSelection.setDebut(selection.getDebut() + 2);
		nouvelleSelection.setFin(selection.getFin() + 5);
		
		assertFalse(selection.getDebut() == nouvelleSelection.getDebut());
		assertFalse(selection.getFin() == nouvelleSelection.getFin());
	}

}
